package com.hp.bon.sgw.bean;


public class CapabilityLimitCfgBean {
	private String hostId;
	private String serviceContextId;
	private String appName;
	
	private String limitCycleUnit;
	private long limitCycle;
	private long limitCycleSecond;
	
	private long limitDiscount;
	private long limitWarning;
	private Long recTime;
	private int limitType;
	
	public String getHostId() {
		return hostId;
	}
	public void setHostId(String hostId) {
		this.hostId = hostId;
	}
	public String getServiceContextId() {
		return serviceContextId;
	}
	public void setServiceContextId(String serviceContextId) {
		this.serviceContextId = serviceContextId;
	}
	public String getAppName() {
		return appName;
	}
	public void setAppName(String appName) {
		this.appName = appName;
	}
	public String getLimitCycleUnit() {
		return limitCycleUnit;
	}
	public void setLimitCycleUnit(String limitCycleUnit) {
		this.limitCycleUnit = limitCycleUnit;
	}
	public long getLimitCycle() {
		return limitCycle;
	}
	public void setLimitCycle(long limitCycle) {
		this.limitCycle = limitCycle;
	}
	public long getLimitDiscount() {
		return limitDiscount;
	}
	public void setLimitDiscount(long limitDiscount) {
		this.limitDiscount = limitDiscount;
	}
	public long getLimitWarning() {
		return limitWarning;
	}
	public void setLimitWarning(long limitWarning) {
		this.limitWarning = limitWarning;
	}
	public int getLimitType() {
		return limitType;
	}
	public void setLimitType(int limitType) {
		this.limitType = limitType;
	}
	
	public long getLimitCycleSecond() {
		return limitCycleSecond;
	}
	
	public void setLimitCycleSecond(long limitCycleSecond) {
		this.limitCycleSecond = limitCycleSecond;
	}
	
	public Long getRecTime() {
		return recTime;
	}
	
	public void setRecTime(Long recTime) {
		this.recTime = recTime;
	}

	public String getLimitKey(){
		return String.format("%s<%s>", this.hostId, this.serviceContextId);
	}
	
	public void calLimitCycleSecond(){
		if(limitCycleUnit.equals("S")){
			limitCycleSecond = limitCycle;
		}else if(limitCycleUnit.equals("M")){
			limitCycleSecond = limitCycle * 60;
		}else if(limitCycleUnit.equals("H")){
			limitCycleSecond = limitCycle * 60 * 60;
		}
	}
}
